import React from 'react';
import { Table, Modal } from 'antd'
import moment from 'moment'

class List extends React.Component {

	edit() {
		// console.log("1")
	}
	async pageChange(pagination) {
		await this.props.onPageChange(pagination);
		this.newPage = pagination.current;
	}
	componentDidMount(){
		const { showList,pagination1 } = this.props
		const params = {
			operatingType: 2,
			page:pagination1.current
		}
		showList(params)
	}
	render() {
		const { list, pagination1, loading } = this.props
		const list1 = [
			{
				key: '1',
				number: '胡彦斌',
				archivesType: 32,
				businessType: '西湖区湖底公园1号'
			}
		]
		const columns = [
			{
				title: "档案年度",
				dataIndex: "documentYear",
				key: "documentYear",
			}, {
				title: "公证事项",
				dataIndex: "notarialMatters",
				key: "notarialMatters",
				render: (text, record) => {
					const datas = text.split("#")
					const ary = []
					datas.map((item, i) => {
						ary.push(
							<p>{item}</p>
						)
					})
					return ary
				}
			},
			{
				title: "申请人",
				dataIndex: "applyName",
				key: "applyName",
				render: (text, record) => {
					const datas = text.split("#")
					const ary = []
					datas.map((item, i) => {
						ary.push(
							<p>{item}</p>
						)
					})
					return ary
				}
			},
			{
				title: "收件日期",
				dataIndex: "createdTime",
				key: "createdTime",
				render: (text, record) => {
					return (
						<p>
							{
								moment(record.createdTime).format("YYYY-MM-DD")
							}
						</p>
					)
				}
			},
			{
				title: "公证日期",
				dataIndex: "notarizationAt",
				key: "notarizationAt",
				render: (text, record) => {
					return (
						<p>
							{
								moment(record.notarizationAt).format("YYYY-MM-DD")
							}
						</p>
					)
				}
			},
			{
				title: "承办人",
				dataIndex: "contractorUserName",
				key: "contractorUserName",
			},
			{
				title: "建档人",
				dataIndex: "createdUserName",
				key: "createdUserName",
			},
			{
				title: "所属机构",
				dataIndex: "organizationName",
				key: "organizationName",
			},
			{
				title: "申请提交日期",
				dataIndex: "applicationCreatedTime",
				key: "applicationCreatedTime",
				render: (text, record) => {
					return (
						<p>
							{
								moment(record.applicationCreatedTime).format("YYYY-MM-DD")
							}
						</p>
					)
				}
			},
			{
				title: '操作',
				dataIndex: 'operation',
				key: 'operation',
				render: (text, record) => {
					return (
						<div>
							<span onClick={this.edit.bind(null, record, 1)} style={{ marginRight: 5 }}><a href="#">催还</a></span>
						</div>
					)
				}
			}
		];
		return (
			<div>
				<Table
					columns={columns}
					dataSource={list}
					loading={loading}
					onChange={this.pageChange.bind(this)}
					pagination={pagination1}
				/>
			</div>
		)
	}
}

export default List